#include <QtGui/QApplication>
#include <QDBusConnection>
#include <QProcess>
#include "mdiareaplayer.h"
#include "handlemplayer.h"
#include "playeradaptor.h"
#include "dbusimpl.h"
#include "../../DbusInterfaces/genericappadaptor.h"

int main(int argc, char *argv[])
{
    QApplication::setGraphicsSystem("raster");
    QApplication a(argc, argv);

    QString pwd = QApplication::applicationDirPath();
    qDebug()<< "dirpath:"<<pwd;

    QString home = "/socMDC/KdeadMouse";
    QString appName = "videoplayer";
    QString appHome = home + "/apps/" + appName;
    MPlayerWrapper *plW = new MPlayerWrapper(home);
    MdiAreaPlayer *pl = new MdiAreaPlayer(appHome,plW);

    plW->setEmbeeder(pl->sw);
    //pl->setGeometry(50,50,1000,600);



    HandleMplayer hp(plW, pl );
    DbusImpl geneApp(appName,pl);

    new PlayerAdaptor(&hp);
    new GenericAppAdaptor(&geneApp);



    QDBusConnection connection = QDBusConnection::sessionBus();
    bool rel = connection.registerService("org.kdeadmouse.apps.videoplayer");
    qDebug()<<"register org.kdeadmouse.apps Service"<< rel;

    rel = connection.registerObject("/specific/videoplayer",&hp);
    qDebug()<<"register /specific/videoplayer object"<< rel;


    rel = connection.registerObject("/generic/videoplayer",&geneApp);
    qDebug()<<"register /generic/videoplayer object"<< rel;


    return a.exec();
}
